#include <bits/stdc++.h>
using namespace std;
const int N=1e2+10;
struct node{
    string name,phone;

    bool operator <(const node &rhs)const{
        return name<rhs.name;
    }
}stu[N];
string s;
int main(void){
    int n;
    printf("输入学生信息\n");
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        cin >> stu[i].name >> stu[i].phone;
    }
    sort(stu,stu+n);
    while(true){
        int l=0,r=n;
        int mid;
        bool flag=false;
        printf("输入要查找的学生姓名\n");
        cin >> s;
        while(l<=r){
            mid=(l+r)>>1;
            if(stu[mid].name==s){
                cout << "找到 " << stu[mid].phone << endl;
                flag=true;
                break;
            }else if(stu[mid].name<s){
                l=mid+1;
            }else{
                r=mid-1;
            }
        }
        if(!flag){
            cout << "没找到" << endl;
        }
    }
    return 0;
}